package com.foreknow.service.impl;

import com.foreknow.dao.ConstanttypeMapper;
import com.foreknow.entity.Constanttype;
import com.foreknow.service.ConstanttypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConstanttypeServiceImpl implements ConstanttypeService {
    @Autowired
    private ConstanttypeMapper constanttypeMapper;

    @Override
    public int insertConstantType(Constanttype constanttype) {
        return constanttypeMapper.insert(constanttype);
    }

    @Override
    public int deleteConstantType(Integer id) {
        return constanttypeMapper.deleteConstantTypeById(id);
    }

    /**
     * 根据id查询要修改的常数类别
     * @param id
     * @return
     */
    @Override
    public Constanttype searchConstantType(Integer id) {
        return constanttypeMapper.selectByPrimaryKey(id);
    }

    /**
     * 修改常数类别
     * @param constanttype
     * @return
     */
    @Override
    public int updateConstantType(Constanttype constanttype) {
        return constanttypeMapper.updateByPrimaryKey(constanttype);
    }

    /**
     *
     * 获取常数类别列表和查询常数类别
     * @param query
     * @return
     */
    @Override
    public List<Constanttype> searchConstantTypeList(String query) {
        return constanttypeMapper.searchAll(query);
    }
}
